Skip to content

Commit

Permalink
Make a feed url derived from search url. See #133
Browse files Browse the repository at this point in the history
  • Loading branch information
breyten committed Apr 3, 2024
1 parent 8a3c0c5 commit bd4124e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/AddColumnBar.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
</select>
</div>
<div class="cell cell-auto-flex flexy">
<a href="#" id="rss-button mdc-button" class="subscribe-button mdc-button">RSS</a>
<a href="{$searchFeedUrl}" id="rss-button mdc-button" class="subscribe-button mdc-button">RSS</a>
</div>
<div class="cell cell-auto-flex flexy">
<Button class="subscribe-button input-full-width" style="width: 100%" on:click={(e) => handleSubscription(e)}>Maak alert aan</Button>
Expand All @@ -63,7 +63,7 @@
</div>
</form>
<script>
import { addInquiry, removeInquiry, inquiries, locations, selectable_locations, id2locations, sources, drawerOpen,fetchingEnabled, identity, isTesting, apiDomainName, domainName, selected_inquiry, selected_inquiry_id } from './stores.js';
import { addInquiry, removeInquiry, inquiries, locations, selectable_locations, id2locations, sources, drawerOpen,fetchingEnabled, identity, isTesting, apiDomainName, domainName, selected_inquiry, selected_inquiry_id, searchFeedUrl } from './stores.js';
import AddColumn, { startAddColumn } from './AddColumn.svelte';
import TopAppBar, {Row, Section, Title} from '@smui/top-app-bar';
import IconButton from '@smui/icon-button';
Expand Down
3 changes: 2 additions & 1 deletion src/sources.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { get } from 'svelte/store';
import { id2locations, apiDomainName, sources, locations } from './stores.js';
import { id2locations, apiDomainName, sources, locations, searchUrl, searchFeedUrl } from './stores.js';

export function fetchSource(query, selected_sources, location_ids, date_start, date_end, sort_field, sort_order, stable, page, callback) {
return fetchFromApi(query, selected_sources, location_ids.map(function (l) { return l.id;}), date_start, date_end, sort_field, sort_order, stable, page, callback);
Expand Down Expand Up @@ -51,6 +51,7 @@ function fetchFromApi(query, selected_sources, location_ids, date_start, date_en
api_filter += date_filter;
var url = window.location.protocol + '//' + apiDomainName + '/documents/search?page='+ page + '&query=' + encodeURIComponent(query || '*') + api_filter +'&sort=' + sort_field + ':' + sort_order + '&limit=50';
console.log(url);
searchUrl.set(url);

return fetch(
url, {cache: 'no-cache'}).then(
Expand Down
3 changes: 3 additions & 0 deletions src/stores.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ export const domainName = 'bron.live';
export const apiDomainName = 'api.' + domainName;
export const testDomainName = 'test.' + domainName;

export const searchUrl = writable('');
export const searchFeedUrl = derived(searchUrl, $searchUrl => $searchUrl + '&format=feed');

//export const isTesting = readable((window.location.hostname == testDomainName));
export const identity = writable(false);
export const isTesting = writable(true);
Expand Down

0 comments on commit bd4124e

Please sign in to comment.